const status = function* () {
  while (true) {
    console.log('On');
    yield true;
    console.log('Off');
    yield false;
  }
}();
status.next();